<?php

namespace App\Jobs\QiPao\Stream;

use App\Jobs\Job;
use App\Repositories\Streamer\StreamerTaskRecordRepository;
use Illuminate\Support\Facades\Log;

class StreamTaskJob extends Job
{

    protected $userId;

    /**
     * Create a new job instance.
     *
     * @return void
     */
    public function __construct($userId)
    {
        $this->userId = $userId;
    }

    /**
     * Execute the job.
     *
     * @return void
     */
    public function handle()
    {
        try {
            Log::info('直播任务');
            StreamerTaskRecordRepository::getInstance()->generateDay([$this->userId]);
            StreamerTaskRecordRepository::getInstance()->generateWeek([$this->userId]);
        } catch (\Exception $e) {
            Log::error('直播任务错误：' . $e->getMessage());
        }
    }
}
